<include file="Public/head" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.css" />
<script src="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<style type="text/css">
    .carowner_1,.carowner_2{display: block;margin-top: 10px;width:100%;height:26px;}
    .carowner_2{margin-left:0px;}
    .select_model{
        -moz-appearance: none;background: rgba(0, 0, 0, 0) url("http://img3.isou365.cn/paimai/yunying/images/sanjiao.jpg") no-repeat scroll 115px 5px;
        border: 1px solid #d7d7d7; color:#7f7f7f;float: left;height: 26px;line-height: 26px;margin-right: 8px;text-indent: 2px;width: 136px;}
    .search_btn{height:26px;line-height:26px;
                background: #20ab4f none repeat scroll 0 0;border-radius: 3px;border:medium none;color: #fff;
                margin-left: 7px;padding: 0;width: 60px;float:left;margin-left: 10px;}
    .bidding_time{float:left;}
    .yuList .listBox table{margin-top: 10px;}
</style>
</head>
<include file="Public/common_header" />
<div class="mian">
    <include file="Public/sidebar"  menu="cxtj.csgl" />
    <div class="mianR">
      <div class='carowner_1'>
            <div class="bidding_time">
                <input type="text" name="start_time" placeholder="车商开账号时间" value="" class="xiaci xin-text1" id="start_time" readonly>
                - <input type="text" name="end_time"  placeholder="车商开账号时间" value="" class="xiaci xin-text1" id="end_time" readonly />
            </div>
            <div class="bidding_time">
                <input type="text" name="dealer_start_time" placeholder="开始时间" value="" class="xiaci xin-text1" id="dealer_start_time" readonly>
                - <input type="text" name="dealer_end_time"  placeholder="结束时间" value="" class="xiaci xin-text1" id="dealer_end_time" readonly />
            </div>

            <select name="order_mode" id="order_mode" class="select_model">
                <option value="0">请选择排序方式</option>
                <option value="1">成交量由高到低</option>
                <option value="2">成交量由低到高</option>
                <option value="3">登陆次数由高到低</option>
                <option value="4">登陆次数由低到高</option>
                <option value="5">关注拍品数量由高到低</option>
                <option value="6">关注拍品数量由低到高</option>
                <option value="7">投标拍品数量由高到低</option>
                <option value="8">投标拍品数量由低到高</option>
                <option value="9">竞拍拍品数量由高到低</option>
                <option value="10">竞拍拍品数量由低到高</option>
                <option value="11">维保查询次数由高到低</option>
                <option value="12">维保查询次数由低到高</option>
            </select>
            <select name="account_manage" id="account_manage" style="float: left;margin-right:30px; " >
                <option value="0">请选择客户经理</option>
                <?php foreach ($manager as $key => $value): ?>
                    <option value="{$value.emp_id}">{$value.real_name}</option>
                <?php endforeach ?>
            </select>
            <div style="clear:both"></div>
          <select name="account_type" id="account_type" style="float:left;margin-right:10px;margin-top:10px;"  class="select_model">
                <option value="-1">请选择账户类型</option>
                <?php foreach(C('DEALER_CERTIFY_TYPE') as $key=>$val):?>
                <option value="{$key}">{$val}</option>
                <?php endforeach ?>
            </select>
             <input type="text" name="search_key" id="search_key" value="" placeholder="车商ID/联系人姓名/联系人电话" style="border: 1px solid #d7d7d7;float: left;height: 24px;line-height: 24px;margin-right:15px;text-align: center;width: 250px; margin:10px 0 10px 0;">
            <input type="button" id="search" value="搜索" class="search_btn" style="margin:10px 0 10px 10px;">
            <div class='clear'></div>
        </div>
        <div class="yuList">
            <div class="listBox" id="listBox"></div>
        </div>
    </div>

    <div class="clear"></div>
    <include file="Public/foot" />

    <script type="text/javascript">
        $("#account_manage").select2();

        //获取url中的参数
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null)
                return unescape(r[2]);
            return null; //返回参数值
        }
        get_list();
        function get_list() {
            var url = get_url();
            var p = getUrlParam('p');
            var purl = '';
            if (p != null) {
                purl = "?p=" + p;
            } else {
                purl = "?p=1";
            }
            $.get("/CarDealer/get_dealer_statistics_list" + purl, encodeURI(url), function (data) {
                $("#listBox").html(data);
            }, "html");
        }

        function get_page(p) {
            var url = get_url();
            url += "&p=" + p;
            $.get("/CarDealer/get_dealer_statistics_list", encodeURI(url), function (data) {
                $("#listBox").html(data);
            }, "html");
        }
        $(".search_btn").on("click", function () {
            get_list();
        });
        function get_url() {
            var url = "";
            var start_time = $("input[name='start_time']").val();
            var end_time = $("input[name='end_time']").val();
            var order_mode = $("#order_mode").find("option:selected").val();
            var account_manage = $("#account_manage").find("option:selected").val();
            var search_key = $("#search_key").val();
            var dealer_start_time = $('#dealer_start_time').val();
            var dealer_end_time = $('#dealer_end_time').val();
            var account_type = $("#account_type").find("option:selected").val();
            if (start_time) {
                url += '&start_time=' + start_time;
            }
            if (end_time) {
                url += '&end_time=' + end_time;
            }
            if (order_mode) {
                url += '&order_mode=' + order_mode;
            }
            if (account_manage) {
                url += '&account_manage=' + account_manage;
            }
            if (search_key) {
                url += '&search_key=' + search_key;
            }
            if (dealer_start_time) {
                url += '&dealer_start_time=' + dealer_start_time;
            }
            if (dealer_end_time) {
                url += '&dealer_end_time=' + dealer_end_time;
            }
            if (account_type) {
                url += '&account_type=' + account_type;
            }
            return url;
        }
       
        $("#start_time").ymdateplugin({
            changeMonth: true,
            changeYear: true
        });

        $("#end_time").ymdateplugin({
            changeMonth: true,
            changeYear: true
        });

        function GetDateStr(AddDayCount) {
            var dd = new Date();
            dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
            var y = dd.getFullYear();
            var m = dd.getMonth()+1;//获取当前月份的日期
            var d = dd.getDate();
            return y+"-"+m+"-"+d;
        }
        var Yesterday = GetDateStr(-1);
        $("#dealer_start_time").ymdateplugin({
            changeMonth: true,
            changeYear: true,
            maxDate:Yesterday  
        });
        $("#dealer_end_time").ymdateplugin({
            changeMonth: true,
            changeYear: true,
            maxDate:Yesterday  

        });
    </script>